package com.ecoolex.ying.space.job.consumer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.ecoolex.framework.message.queue.Consumer;
import com.ecoolex.framework.message.queue.ConsumerComponent;
import com.ecoolex.framework.message.queue.Message;
import com.ecoolex.framework.modularize.api.service.audit.AuditService;
import com.ecoolex.ying.space.core.manager.UserWorksAuditManager;
import com.ecoolex.ying.space.job.core.JOBConstant;


@ConsumerComponent
public class UserWorksAuditResultConsumer {

    private Logger log = LoggerFactory.getLogger(UserWorksAuditResultConsumer.class);

    @Autowired
    private AuditService auditService;

    @Autowired
    private UserWorksAuditManager userWorksAuditManager;

    @Consumer(group = JOBConstant.MODULE_NAME, theme = "admin.system.audit.result.UserWorks", describe = "用户作品审核结果消费")
    public void worksAuditNotify(Message message) throws Exception {
        Integer recordId = Integer.valueOf(message.getContent());
        userWorksAuditManager.worksAuditNotify(auditService.result(recordId));
    }

    @Consumer(group = JOBConstant.MODULE_NAME,
        theme = "admin.system.audit.result.UserWorksComment",
        describe = "用户作品评论审核结果消费")
    public void commentAuditNotify(Message message) throws Exception {
        Integer recordId = Integer.valueOf(message.getContent());
        userWorksAuditManager.commentAuditNotify(auditService.result(recordId));
    }

}
